package com.example.autopia.view.ViewHolders.Transactions

import android.view.LayoutInflater
import android.view.animation.AnimationUtils
import androidx.recyclerview.widget.RecyclerView
import com.example.autopia.R
import com.example.autopia.databinding.ViewholderTransactionPastBinding
import com.example.autopia.model.Item.Transaction
import com.example.autopia.utilities.TimeManager

class PastTransactionViewHolder (private val binding: ViewholderTransactionPastBinding, private val inflater: LayoutInflater,val timeManager: TimeManager) :
    RecyclerView.ViewHolder(binding.root) {

    fun bind(transaction: Transaction){
        binding.tvName.text = transaction.namePark
        binding.tvId.text = "#"+transaction.id
        binding.tvStartTime.text = timeManager.unixTimeToDateTimeComment(transaction.startTime)
        binding.tvEndTime.text =timeManager.unixTimeToDateTimeComment(transaction.endTime)
        binding.tvPlace.text = "место: " + transaction.place!!.id.toString()
        binding.tvNumber.text = "авто: " + transaction.place.car!!.number

        val animation = AnimationUtils.loadAnimation(inflater.context, R.anim.fade_in)
        binding.root.startAnimation(animation)
    }
}